package c.c.c.a.e;

import android.content.Context;
import android.os.Build;
import android.text.TextUtils;
import c.c.c.a.i.c;
import c.c.c.a.n;
import org.json.JSONException;
import org.json.JSONObject;

/* compiled from: Header */
public final class b {
    public static final String[] c = new String[]{"version_code", "manifest_version_code", "aid", "update_version_code"};
    public Context a;
    public JSONObject b = new JSONObject();

    public b(Context context) {
        this.a = context;
    }

    /* JADX WARNING: Removed duplicated region for block: B:27:0x00e6 A:{Catch:{ Exception -> 0x011b }} */
    /* JADX WARNING: Removed duplicated region for block: B:30:0x00f9 A:{Catch:{ Exception -> 0x011b }} */
    /* JADX WARNING: Removed duplicated region for block: B:33:0x010e A:{Catch:{ Exception -> 0x011b }} */
    /* JADX WARNING: Removed duplicated region for block: B:36:0x0114 A:{Catch:{ Exception -> 0x011b }} */
    /* JADX WARNING: Removed duplicated region for block: B:44:0x012c A:{Catch:{ all -> 0x0172 }} */
    /* JADX WARNING: Removed duplicated region for block: B:43:0x0126 A:{Catch:{ all -> 0x0172 }} */
    /* JADX WARNING: Removed duplicated region for block: B:55:0x0160 A:{Catch:{ all -> 0x0172 }} */
    /* JADX WARNING: Removed duplicated region for block: B:64:0x018e A:{Catch:{ Exception -> 0x01ad }} */
    /* JADX WARNING: Removed duplicated region for block: B:77:0x01bb  */
    /* JADX WARNING: Removed duplicated region for block: B:80:0x01c7 A:{SYNTHETIC, Splitter:B:80:0x01c7} */
    /* JADX WARNING: Missing exception handler attribute for start block: B:24:0x00d0 */
    /* JADX WARNING: Removed duplicated region for block: B:64:0x018e A:{Catch:{ Exception -> 0x01ad }} */
    /* JADX WARNING: Removed duplicated region for block: B:77:0x01bb  */
    /* JADX WARNING: Removed duplicated region for block: B:80:0x01c7 A:{SYNTHETIC, Splitter:B:80:0x01c7} */
    /* JADX WARNING: Missing exception handler attribute for start block: B:57:0x0172 */
    /* JADX WARNING: Removed duplicated region for block: B:22:0x00a7 A:{Catch:{ Exception -> 0x00d0 }} */
    /* JADX WARNING: Removed duplicated region for block: B:15:0x0096 A:{Catch:{ Exception -> 0x00d0 }} */
    /* JADX WARNING: Removed duplicated region for block: B:27:0x00e6 A:{Catch:{ Exception -> 0x011b }} */
    /* JADX WARNING: Removed duplicated region for block: B:30:0x00f9 A:{Catch:{ Exception -> 0x011b }} */
    /* JADX WARNING: Removed duplicated region for block: B:33:0x010e A:{Catch:{ Exception -> 0x011b }} */
    /* JADX WARNING: Removed duplicated region for block: B:36:0x0114 A:{Catch:{ Exception -> 0x011b }} */
    /* JADX WARNING: Removed duplicated region for block: B:43:0x0126 A:{Catch:{ all -> 0x0172 }} */
    /* JADX WARNING: Removed duplicated region for block: B:44:0x012c A:{Catch:{ all -> 0x0172 }} */
    /* JADX WARNING: Removed duplicated region for block: B:55:0x0160 A:{Catch:{ all -> 0x0172 }} */
    /* JADX WARNING: Removed duplicated region for block: B:64:0x018e A:{Catch:{ Exception -> 0x01ad }} */
    /* JADX WARNING: Removed duplicated region for block: B:77:0x01bb  */
    /* JADX WARNING: Removed duplicated region for block: B:80:0x01c7 A:{SYNTHETIC, Splitter:B:80:0x01c7} */
    /* JADX WARNING: Missing exception handler attribute for start block: B:12:0x0086 */
    /* JADX WARNING: Failed to process nested try/catch */
    /* JADX WARNING: Failed to process nested try/catch */
    /* JADX WARNING: Can't wrap try/catch for region: R(24:0|1|2|(2:4|(1:6))|7|(1:9)(1:10)|11|12|13|(2:15|(2:17|(1:19)(1:20))(1:21))(1:22)|23|(10:24|25|(1:27)|28|(1:30)|31|(1:33)|34|(1:36)|37)|38|40|41|(1:43)(2:44|(1:46)(4:47|(1:49)|50|(1:52)))|53|(1:55)|56|(2:57|58)|(3:61|62|(4:64|(1:66)|67|(1:69)))|72|(4:75|(1:77)|78|(5:80|81|(4:84|(2:86|96)(2:87|(2:89|98)(1:97))|94|82)|95|90))|93) */
    public static c.c.c.a.e.b a(android.content.Context r6) {
        /*
        r0 = new c.c.c.a.e.b;
        r0.m1061init(r6);
        r6 = r0.b;
        r1 = r0.a;	 Catch:{ Exception -> 0x0086 }
        r1 = r1.getPackageName();	 Catch:{ Exception -> 0x0086 }
        r2 = r0.a;	 Catch:{ Exception -> 0x0086 }
        r2 = r2.getPackageManager();	 Catch:{ Exception -> 0x0086 }
        r3 = 0;
        r1 = r2.getPackageInfo(r1, r3);	 Catch:{ Exception -> 0x0086 }
        r1 = r1.applicationInfo;	 Catch:{ Exception -> 0x0086 }
        if (r1 == 0) goto L_0x002b;
    L_0x001c:
        r1 = r1.labelRes;	 Catch:{ Exception -> 0x0086 }
        if (r1 <= 0) goto L_0x002b;
    L_0x0020:
        r2 = "display_name";
        r3 = r0.a;	 Catch:{ Exception -> 0x0086 }
        r1 = r3.getString(r1);	 Catch:{ Exception -> 0x0086 }
        r6.put(r2, r1);	 Catch:{ Exception -> 0x0086 }
    L_0x002b:
        r1 = "sdk_version";
        r2 = 22130; // 0x5672 float:3.1011E-41 double:1.09337E-319;
        r6.put(r1, r2);	 Catch:{ Exception -> 0x0086 }
        r1 = "sdk_version_name";
        r2 = "2.2.1-alpha.30";
        r6.put(r1, r2);	 Catch:{ Exception -> 0x0086 }
        r1 = "os";
        r2 = "Android";
        r6.put(r1, r2);	 Catch:{ Exception -> 0x0086 }
        r1 = "os_version";
        r2 = android.os.Build.VERSION.RELEASE;	 Catch:{ Exception -> 0x0086 }
        r3 = ".";
        r3 = r2.contains(r3);	 Catch:{ Exception -> 0x0086 }
        if (r3 == 0) goto L_0x004d;
    L_0x004c:
        goto L_0x005e;
    L_0x004d:
        r3 = new java.lang.StringBuilder;	 Catch:{ Exception -> 0x0086 }
        r3.<init>();	 Catch:{ Exception -> 0x0086 }
        r3.append(r2);	 Catch:{ Exception -> 0x0086 }
        r2 = ".0";
        r3.append(r2);	 Catch:{ Exception -> 0x0086 }
        r2 = r3.toString();	 Catch:{ Exception -> 0x0086 }
    L_0x005e:
        r6.put(r1, r2);	 Catch:{ Exception -> 0x0086 }
        r1 = "os_api";
        r2 = android.os.Build.VERSION.SDK_INT;	 Catch:{ Exception -> 0x0086 }
        r6.put(r1, r2);	 Catch:{ Exception -> 0x0086 }
        r1 = "device_model";
        r2 = android.os.Build.MODEL;	 Catch:{ Exception -> 0x0086 }
        r6.put(r1, r2);	 Catch:{ Exception -> 0x0086 }
        r1 = "device_brand";
        r2 = android.os.Build.BRAND;	 Catch:{ Exception -> 0x0086 }
        r6.put(r1, r2);	 Catch:{ Exception -> 0x0086 }
        r1 = "device_manufacturer";
        r2 = android.os.Build.MANUFACTURER;	 Catch:{ Exception -> 0x0086 }
        r6.put(r1, r2);	 Catch:{ Exception -> 0x0086 }
        r1 = "cpu_abi";
        r2 = r0.d();	 Catch:{ Exception -> 0x0086 }
        r6.put(r1, r2);	 Catch:{ Exception -> 0x0086 }
    L_0x0086:
        r1 = r0.a;	 Catch:{ Exception -> 0x00d0 }
        r1 = r1.getResources();	 Catch:{ Exception -> 0x00d0 }
        r1 = r1.getDisplayMetrics();	 Catch:{ Exception -> 0x00d0 }
        r2 = r1.densityDpi;	 Catch:{ Exception -> 0x00d0 }
        r3 = 120; // 0x78 float:1.68E-43 double:5.93E-322;
        if (r2 == r3) goto L_0x00a7;
    L_0x0096:
        r3 = 240; // 0xf0 float:3.36E-43 double:1.186E-321;
        if (r2 == r3) goto L_0x00a4;
    L_0x009a:
        r3 = 320; // 0x140 float:4.48E-43 double:1.58E-321;
        if (r2 == r3) goto L_0x00a1;
    L_0x009e:
        r3 = "mdpi";
        goto L_0x00a9;
    L_0x00a1:
        r3 = "xhdpi";
        goto L_0x00a9;
    L_0x00a4:
        r3 = "hdpi";
        goto L_0x00a9;
    L_0x00a7:
        r3 = "ldpi";
    L_0x00a9:
        r4 = "density_dpi";
        r6.put(r4, r2);	 Catch:{ Exception -> 0x00d0 }
        r2 = "display_density";
        r6.put(r2, r3);	 Catch:{ Exception -> 0x00d0 }
        r2 = "resolution";
        r3 = new java.lang.StringBuilder;	 Catch:{ Exception -> 0x00d0 }
        r3.<init>();	 Catch:{ Exception -> 0x00d0 }
        r4 = r1.heightPixels;	 Catch:{ Exception -> 0x00d0 }
        r3.append(r4);	 Catch:{ Exception -> 0x00d0 }
        r4 = "x";
        r3.append(r4);	 Catch:{ Exception -> 0x00d0 }
        r1 = r1.widthPixels;	 Catch:{ Exception -> 0x00d0 }
        r3.append(r1);	 Catch:{ Exception -> 0x00d0 }
        r1 = r3.toString();	 Catch:{ Exception -> 0x00d0 }
        r6.put(r2, r1);	 Catch:{ Exception -> 0x00d0 }
    L_0x00d0:
        r1 = r0.a;	 Catch:{ Exception -> 0x011b }
        r1 = r1.getResources();	 Catch:{ Exception -> 0x011b }
        r1 = r1.getConfiguration();	 Catch:{ Exception -> 0x011b }
        r1 = r1.locale;	 Catch:{ Exception -> 0x011b }
        r1 = r1.getLanguage();	 Catch:{ Exception -> 0x011b }
        r2 = android.text.TextUtils.isEmpty(r1);	 Catch:{ Exception -> 0x011b }
        if (r2 != 0) goto L_0x00eb;
    L_0x00e6:
        r2 = "language";
        r6.put(r2, r1);	 Catch:{ Exception -> 0x011b }
    L_0x00eb:
        r1 = java.util.Locale.getDefault();	 Catch:{ Exception -> 0x011b }
        r1 = r1.getCountry();	 Catch:{ Exception -> 0x011b }
        r2 = android.text.TextUtils.isEmpty(r1);	 Catch:{ Exception -> 0x011b }
        if (r2 != 0) goto L_0x00fe;
    L_0x00f9:
        r2 = "region";
        r6.put(r2, r1);	 Catch:{ Exception -> 0x011b }
    L_0x00fe:
        r1 = java.util.TimeZone.getDefault();	 Catch:{ Exception -> 0x011b }
        r1 = r1.getRawOffset();	 Catch:{ Exception -> 0x011b }
        r2 = 3600000; // 0x36ee80 float:5.044674E-39 double:1.7786363E-317;
        r1 = r1 / r2;
        r2 = -12;
        if (r1 >= r2) goto L_0x0110;
    L_0x010e:
        r1 = -12;
    L_0x0110:
        r2 = 12;
        if (r1 <= r2) goto L_0x0116;
    L_0x0114:
        r1 = 12;
    L_0x0116:
        r2 = "timezone";
        r6.put(r2, r1);	 Catch:{ Exception -> 0x011b }
    L_0x011b:
        r1 = new java.lang.StringBuilder;
        r1.<init>();
        r2 = c.c.c.a.m.c.c();	 Catch:{ all -> 0x0172 }
        if (r2 == 0) goto L_0x012c;
    L_0x0126:
        r2 = "MIUI-";
        r1.append(r2);	 Catch:{ all -> 0x0172 }
        goto L_0x0155;
    L_0x012c:
        r2 = c.c.c.a.m.c.d();	 Catch:{ all -> 0x0172 }
        if (r2 == 0) goto L_0x0138;
    L_0x0132:
        r2 = "FLYME-";
        r1.append(r2);	 Catch:{ all -> 0x0172 }
        goto L_0x0155;
    L_0x0138:
        r2 = c.c.c.a.m.c.a();	 Catch:{ all -> 0x0172 }
        r3 = c.c.c.a.m.c.b(r2);	 Catch:{ all -> 0x0172 }
        if (r3 == 0) goto L_0x0147;
    L_0x0142:
        r3 = "EMUI-";
        r1.append(r3);	 Catch:{ all -> 0x0172 }
    L_0x0147:
        r3 = android.text.TextUtils.isEmpty(r2);	 Catch:{ all -> 0x0172 }
        if (r3 != 0) goto L_0x0155;
    L_0x014d:
        r1.append(r2);	 Catch:{ all -> 0x0172 }
        r2 = "-";
        r1.append(r2);	 Catch:{ all -> 0x0172 }
    L_0x0155:
        r2 = android.os.Build.VERSION.INCREMENTAL;	 Catch:{ all -> 0x0172 }
        r1.append(r2);	 Catch:{ all -> 0x0172 }
        r2 = r1.length();	 Catch:{ all -> 0x0172 }
        if (r2 <= 0) goto L_0x0169;
    L_0x0160:
        r2 = "rom";
        r1 = r1.toString();	 Catch:{ all -> 0x0172 }
        r6.put(r2, r1);	 Catch:{ all -> 0x0172 }
    L_0x0169:
        r1 = "rom_version";
        r2 = c.c.c.a.m.g.a();	 Catch:{ all -> 0x0172 }
        r6.put(r1, r2);	 Catch:{ all -> 0x0172 }
    L_0x0172:
        r1 = "access";
        r2 = r0.a;	 Catch:{ JSONException -> 0x017e }
        r2 = b.i.b.f.h(r2);	 Catch:{ JSONException -> 0x017e }
        r6.put(r1, r2);	 Catch:{ JSONException -> 0x017e }
        goto L_0x0182;
    L_0x017e:
        r1 = move-exception;
        r1.printStackTrace();
    L_0x0182:
        r1 = r0.a;	 Catch:{ Exception -> 0x01ad }
        r2 = "phone";
        r1 = r1.getSystemService(r2);	 Catch:{ Exception -> 0x01ad }
        r1 = (android.telephony.TelephonyManager) r1;	 Catch:{ Exception -> 0x01ad }
        if (r1 == 0) goto L_0x01b1;
    L_0x018e:
        r2 = r1.getNetworkOperatorName();	 Catch:{ Exception -> 0x01ad }
        r3 = android.text.TextUtils.isEmpty(r2);	 Catch:{ Exception -> 0x01ad }
        if (r3 != 0) goto L_0x019d;
    L_0x0198:
        r3 = "carrier";
        r6.put(r3, r2);	 Catch:{ Exception -> 0x01ad }
    L_0x019d:
        r1 = r1.getNetworkOperator();	 Catch:{ Exception -> 0x01ad }
        r2 = android.text.TextUtils.isEmpty(r1);	 Catch:{ Exception -> 0x01ad }
        if (r2 != 0) goto L_0x01b1;
    L_0x01a7:
        r2 = "mcc_mnc";
        r6.put(r2, r1);	 Catch:{ Exception -> 0x01ad }
        goto L_0x01b1;
    L_0x01ad:
        r1 = move-exception;
        r1.printStackTrace();
    L_0x01b1:
        r1 = c.c.c.a.n.c;
        if (r1 == 0) goto L_0x01fb;
    L_0x01b5:
        if (r6 == 0) goto L_0x01fb;
    L_0x01b7:
        r2 = r1.c;
        if (r2 != 0) goto L_0x01c3;
    L_0x01bb:
        r2 = r1.b;
        r2 = r2.g();
        r1.c = r2;
    L_0x01c3:
        r1 = r1.c;
        if (r1 == 0) goto L_0x01fb;
    L_0x01c7:
        r2 = new org.json.JSONObject;	 Catch:{ Exception -> 0x01f7 }
        r2.<init>();	 Catch:{ Exception -> 0x01f7 }
        r3 = r1.keySet();	 Catch:{ Exception -> 0x01f7 }
        r3 = r3.iterator();	 Catch:{ Exception -> 0x01f7 }
    L_0x01d4:
        r4 = r3.hasNext();	 Catch:{ Exception -> 0x01f7 }
        if (r4 == 0) goto L_0x01f1;
    L_0x01da:
        r4 = r3.next();	 Catch:{ Exception -> 0x01f7 }
        r4 = (java.lang.String) r4;	 Catch:{ Exception -> 0x01f7 }
        r5 = android.text.TextUtils.isEmpty(r4);	 Catch:{ Exception -> 0x01f7 }
        if (r5 == 0) goto L_0x01e7;
    L_0x01e6:
        goto L_0x01d4;
    L_0x01e7:
        r5 = r1.get(r4);	 Catch:{ Exception -> 0x01f7 }
        if (r5 == 0) goto L_0x01d4;
    L_0x01ed:
        r2.put(r4, r5);	 Catch:{ Exception -> 0x01f7 }
        goto L_0x01d4;
    L_0x01f1:
        r1 = "custom";
        r6.put(r1, r2);	 Catch:{ Exception -> 0x01f7 }
        goto L_0x01fb;
    L_0x01f7:
        r6 = c.c.c.a.n.a;
        r6 = c.c.c.a.n.d;
    L_0x01fb:
        return r0;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.c.c.a.e.b.a(android.content.Context):c.c.c.a.e.b");
    }

    public JSONObject b(String str) {
        try {
            this.b.put("device_id", str);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return this.b;
    }

    /* JADX WARNING: Missing exception handler attribute for start block: B:14:0x0056 */
    /* JADX WARNING: Can't wrap try/catch for region: R(5:12|13|14|15|33) */
    public org.json.JSONObject c(java.util.Map<java.lang.String, java.lang.Object> r10) {
        /*
        r9 = this;
        r0 = "manifest_version_code";
        r1 = "version_code";
        r2 = "iid";
        r3 = r10.entrySet();	 Catch:{ all -> 0x0093 }
        r3 = r3.iterator();	 Catch:{ all -> 0x0093 }
    L_0x000e:
        r4 = r3.hasNext();	 Catch:{ all -> 0x0093 }
        if (r4 == 0) goto L_0x0038;
    L_0x0014:
        r4 = r3.next();	 Catch:{ all -> 0x0093 }
        r4 = (java.util.Map.Entry) r4;	 Catch:{ all -> 0x0093 }
        r5 = r9.b;	 Catch:{ all -> 0x0093 }
        r6 = r4.getKey();	 Catch:{ all -> 0x0093 }
        r6 = (java.lang.String) r6;	 Catch:{ all -> 0x0093 }
        r5 = r5.has(r6);	 Catch:{ all -> 0x0093 }
        if (r5 != 0) goto L_0x000e;
    L_0x0028:
        r5 = r9.b;	 Catch:{ all -> 0x0093 }
        r6 = r4.getKey();	 Catch:{ all -> 0x0093 }
        r6 = (java.lang.String) r6;	 Catch:{ all -> 0x0093 }
        r4 = r4.getValue();	 Catch:{ all -> 0x0093 }
        r5.put(r6, r4);	 Catch:{ all -> 0x0093 }
        goto L_0x000e;
    L_0x0038:
        r3 = c;	 Catch:{ all -> 0x0093 }
        r4 = r3.length;	 Catch:{ all -> 0x0093 }
        r5 = 0;
    L_0x003c:
        if (r5 >= r4) goto L_0x0062;
    L_0x003e:
        r6 = r3[r5];	 Catch:{ all -> 0x0093 }
        r7 = r10.containsKey(r6);	 Catch:{ all -> 0x0093 }
        if (r7 == 0) goto L_0x005f;
    L_0x0046:
        r7 = r10.get(r6);	 Catch:{ Exception -> 0x0056 }
        r7 = (java.lang.String) r7;	 Catch:{ Exception -> 0x0056 }
        r7 = java.lang.Integer.parseInt(r7);	 Catch:{ Exception -> 0x0056 }
        r8 = r9.b;	 Catch:{ Exception -> 0x0056 }
        r8.put(r6, r7);	 Catch:{ Exception -> 0x0056 }
        goto L_0x005f;
    L_0x0056:
        r7 = r9.b;	 Catch:{ all -> 0x0093 }
        r8 = r10.get(r6);	 Catch:{ all -> 0x0093 }
        r7.put(r6, r8);	 Catch:{ all -> 0x0093 }
    L_0x005f:
        r5 = r5 + 1;
        goto L_0x003c;
    L_0x0062:
        r3 = r10.containsKey(r1);	 Catch:{ all -> 0x0093 }
        if (r3 == 0) goto L_0x007d;
    L_0x0068:
        r3 = r10.containsKey(r0);	 Catch:{ all -> 0x0093 }
        if (r3 != 0) goto L_0x007d;
    L_0x006e:
        r1 = r10.get(r1);	 Catch:{ all -> 0x0093 }
        r1 = (java.lang.String) r1;	 Catch:{ all -> 0x0093 }
        r1 = java.lang.Integer.parseInt(r1);	 Catch:{ all -> 0x0093 }
        r3 = r9.b;	 Catch:{ all -> 0x0093 }
        r3.put(r0, r1);	 Catch:{ all -> 0x0093 }
    L_0x007d:
        r0 = r10.containsKey(r2);	 Catch:{ all -> 0x0093 }
        if (r0 == 0) goto L_0x0093;
    L_0x0083:
        r0 = r9.b;	 Catch:{ all -> 0x0093 }
        r1 = "udid";
        r10 = r10.get(r2);	 Catch:{ all -> 0x0093 }
        r0.put(r1, r10);	 Catch:{ all -> 0x0093 }
        r10 = r9.b;	 Catch:{ all -> 0x0093 }
        r10.remove(r2);	 Catch:{ all -> 0x0093 }
    L_0x0093:
        r10 = r9.b;
        return r10;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.c.c.a.e.b.c(java.util.Map):org.json.JSONObject");
    }

    public final String d() {
        String str = "unknown";
        try {
            StringBuilder stringBuilder = new StringBuilder();
            if (Build.SUPPORTED_ABIS.length > 0) {
                int i = 0;
                while (true) {
                    String[] strArr = Build.SUPPORTED_ABIS;
                    if (i >= strArr.length) {
                        break;
                    }
                    stringBuilder.append(strArr[i]);
                    if (i != strArr.length - 1) {
                        stringBuilder.append(", ");
                    }
                    i++;
                }
            } else {
                stringBuilder = new StringBuilder(Build.CPU_ABI);
            }
            if (TextUtils.isEmpty(stringBuilder.toString())) {
                return str;
            }
            return stringBuilder.toString();
        } catch (Exception unused) {
            Context context = n.a;
            c cVar = n.d;
            return str;
        }
    }

    public JSONObject e(String str) {
        try {
            if (!TextUtils.isEmpty(str)) {
                this.b.put("user_id", str);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return this.b;
    }
}
